function request(url, params = {}, type = "get") {
    return new Promise(function (resolve, reject) {
        $.ajax({
            type: type,
            url: url,
            data: { id: params },
            dataType: "json",
            success: function (res) {
                resolve(res); //请求成功 => {fulfilled:res}
            },
            error: function (err) {
                reject(err); // 代码出错 => {rejected:err}
            }
        })
    })
    // 调用此方法返回 Promise实例:{pending:undefined} => 请求有结果之后在改变状态
}

const searchAllGoods = params => request("../php/searchShoppingUser.php", params, "get");
const searchAllId = params => request("../php/searchAllId.php", params, "get");
